home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / demos / northstardemo / demoreloc.s < prev    next >
Text File  |  1980-01-03  |  27KB  |  1,139 lines

  1. bobs:    equ    34    ;howmany bobs ?
  2.  
  3. ;  All routines made by ATOM of North Star.
  4. ;  The routines have been made to be as simple
  5. ;  and easy to understand as possible, thats
  6. ;  why some of my old(very old) routines
  7. ;  have been used and not the new ones.
  8. ;  But when you understand the principles
  9. ;  you should have no problems improving
  10. ;  them, and that's the point RIGHT ????
  11. ;
  12. ;  All routines might be used as you want
  13. ;  but the grafix and music is NS property.
  14. ;  
  15. ;  And it would be rather lame-looking if
  16. ;  you used the same font and music.....
  17. ;
  18. ;  Sorry for the late delivery date, but I had to
  19. ;  visit some American software houses for a few
  20. ;  weeks, but better late then never - Right Shredder ?!?
  21.  
  22. ************************************************************
  23. *
  24. *              hardware references
  25. *
  26. ************************************************************
  27.  
  28. custom:     equ        $dff000
  29. bltddat:    equ        $000
  30. dmaconr:    equ        $002
  31. vposr:      equ        $004
  32. vhposr:     equ        $006
  33. dskdatr:    equ        $008
  34. joy0dat:    equ        $00a
  35. joy1dat:    equ        $00c
  36. clxdat:     equ        $00e
  37. adkconr:    equ        $010
  38. pot0dat:    equ        $012
  39. pot1dat:    equ        $014
  40. potgor:     equ        $016
  41. serdatr:    equ        $018
  42. dskbytr:    equ        $01a
  43. intenar:    equ        $01c
  44. intreqr:    equ        $01e
  45. dskpth:     equ        $020
  46. dskptl:     equ        $022
  47. dsklen:     equ        $024
  48. dskdat:     equ        $026
  49. refptr:     equ        $028
  50. vposw:      equ        $02a
  51. vhposw:     equ        $02c
  52. copcon:     equ        $02e
  53. serdat:     equ        $030
  54. serper:     equ        $032
  55. potgo:      equ        $034
  56. joytest:    equ        $036
  57. strequ:     equ        $038
  58. strvbl:     equ        $03a
  59. strhor:     equ        $03c
  60. strlong:    equ        $03e
  61. bltcon0:    equ        $040
  62. bltcon1:    equ        $042
  63. bltafwm:    equ        $044
  64. bltalwm:    equ        $046
  65. bltcpth:    equ        $048
  66. bltcptl:    equ        $04a
  67. bltbpth:    equ        $04c
  68. bltbptl:    equ        $04e
  69. bltapth:    equ        $050
  70. bltaptl:    equ        $052
  71. bltdpth:    equ        $054
  72. bltdptl:    equ        $056
  73. bltsize:    equ        $058
  74. bltcmod:    equ        $060
  75. bltbmod:    equ        $062
  76. bltamod:    equ        $064
  77. bltdmod:    equ        $066
  78. bltcdat:    equ        $070
  79. bltbdat:    equ        $072
  80. bltadat:    equ        $074
  81. dsksync:    equ        $07e
  82. cop1lch:    equ        $080
  83. cop1lcl:    equ        $082
  84. cop2lch:    equ        $084
  85. cop2lcl:    equ        $086
  86. copjmp1:    equ        $088
  87. copjmp2:    equ        $08a
  88. copins:     equ        $08c
  89. diwstrt:    equ        $08e
  90. diwstop:    equ        $090
  91. ddfstrt:    equ        $092
  92. ddfstop:    equ        $094
  93. dmacon:     equ        $096
  94. clxcon:     equ        $098
  95. intena:     equ        $09a
  96. intreq:     equ        $09c
  97. adkcon:     equ        $09e
  98. aud0lch:    equ        $0a0
  99. aud0lcl:    equ        $0a2
  100. aud0len:    equ        $0a4
  101. aud0per:    equ        $0a6
  102. aud0vol:    equ        $0a8
  103. aud0dat:    equ        $0aa
  104. aud1lch:    equ        $0b0
  105. aud1lcl:    equ        $0b2
  106. aud1len:    equ        $0b4
  107. aud1per:    equ        $0b6
  108. aud1vol:    equ        $0b8
  109. aud1dat:    equ        $0ba
  110. aud2lch:    equ        $0c0
  111. aud2lcl:    equ        $0c2
  112. aud2len:    equ        $0c4
  113. aud2per:    equ        $0c6
  114. aud2vol:    equ        $0c8
  115. aud2dat:    equ        $0ca
  116. aud3lch:    equ        $0d0
  117. aud3lcl:    equ        $0d2
  118. aud3len:    equ        $0d4
  119. aud3per:    equ        $0d6
  120. aud3vol:    equ        $0d8
  121. aud3dat:    equ        $0da
  122. bpl1pth:    equ        $0e0
  123. bpl1ptl:    equ        $0e2
  124. bpl2pth:    equ        $0e4
  125. bpl2ptl:    equ        $0e6
  126. bpl3pth:    equ        $0e8
  127. bpl3ptl:    equ        $0ea
  128. bpl4pth:    equ        $0ec
  129. bpl4ptl:    equ        $0ee
  130. bpl5pth:    equ        $0f0
  131. bpl5ptl:    equ        $0f2
  132. bpl6pth:    equ        $0f4
  133. bpl6ptl:    equ        $0f6
  134. bplcon0:    equ        $100
  135. bplcon1:    equ        $102
  136. bplcon2:    equ        $104
  137. bpl1mod:    equ        $108
  138. bpl2mod:    equ        $10a
  139. bpl1dat:    equ        $110
  140. bpl2dat:    equ        $112
  141. bpl3dat:    equ        $114
  142. bpl4dat:    equ        $116
  143. bpl5dat:    equ        $118
  144. bpl6dat:    equ        $11a
  145. spr0pth:    equ        $120
  146. spr0ptl:    equ        $122
  147. spr1pth:    equ        $124
  148. spr1ptl:    equ        $126
  149. spr2pth:    equ        $128
  150. spr2ptl:    equ        $12a
  151. spr3pth:    equ        $12c
  152. spr3ptl:    equ        $12e
  153. spr4pth:    equ        $130
  154. spr4ptl:    equ        $132
  155. spr5pth:    equ        $134
  156. spr5ptl:    equ        $136
  157. spr6pth:    equ        $138
  158. spr6ptl:    equ        $13a
  159. spr7pth:    equ        $13c
  160. spr7ptl:    equ        $13e
  161. spr0pos:    equ        $140
  162. spr0ctl:    equ        $142
  163. spr0data:   equ        $144
  164. spr0datb:   equ        $146
  165. spr1pos:    equ        $148
  166. spr1ctl:    equ        $14a
  167. spr1data:   equ        $14c
  168. spr1datb:   equ        $14e
  169. spr2pos:    equ        $150
  170. spr2ctl:    equ        $152
  171. spr2data:   equ        $154
  172. spr2datb:   equ        $156
  173. spr3pos:    equ        $158
  174. spr3ctl:    equ        $15a
  175. spr3data:   equ        $15c
  176. spr3datb:   equ        $15e
  177. spr4pos:    equ        $160
  178. spr4ctl:    equ        $162
  179. spr4data:   equ        $164
  180. spr4datb:   equ        $166
  181. spr5pos:    equ        $168
  182. spr5ctl:    equ        $16a
  183. spr5data:   equ        $16c
  184. spr5datb:   equ        $16e
  185. spr6pos:    equ        $170
  186. spr6ctl:    equ        $172
  187. spr6data:   equ        $174
  188. spr6datb:   equ        $176
  189. spr7pos:    equ        $178
  190. spr7ctl:    equ        $17a
  191. spr7data:   equ        $17c
  192. spr7datb:   equ        $17e
  193. color00:    equ        $180
  194. color01:    equ        $182
  195. color02:    equ        $184
  196. color03:    equ        $186
  197. color04:    equ        $188
  198. color05:    equ        $18a
  199. color06:    equ        $18c
  200. color07:    equ        $18e
  201. color08:    equ        $190
  202. color09:    equ        $192
  203. color10:    equ        $194
  204. color11:    equ        $196
  205. color12:    equ        $198
  206. color13:    equ        $19a
  207. color14:    equ        $19c
  208. color15:    equ        $19e
  209. color16:    equ        $1a0
  210. color17:    equ        $1a2
  211. color18:    equ        $1a4
  212. color19:    equ        $1a6
  213. color20:    equ        $1a8
  214. color21:    equ        $1aa
  215. color22:    equ        $1ac
  216. color23:    equ        $1ae
  217. color24:    equ        $1b0
  218. color25:    equ        $1b2
  219. color26:    equ        $1b4
  220. color27:    equ        $1b6
  221. color28:    equ        $1b8
  222. color29:    equ        $1ba
  223. color30:    equ        $1bc
  224. color31:    equ        $1be
  225.  
  226.  
  227. ************************************************************
  228. *
  229. *              clist.lib.offsets
  230. *
  231. ************************************************************
  232.  
  233.  
  234. initclpool:     equ            -30
  235. allocclist:     equ            -36
  236. freeclist:      equ            -42
  237. flushclist:     equ            -48
  238. sizeclist:      equ            -54
  239. putclchar:      equ            -60
  240. getclchar:      equ            -66
  241. ungetclchar:    equ            -72
  242. unputlcchar:    equ            -78
  243. putclword:      equ            -84
  244. getclword:      equ            -90
  245. ungetclword:    equ            -96
  246. unputclword:    equ            -102
  247. putclbuf:       equ            -108
  248. getclbuf:       equ            -114
  249. markclist:      equ            -120
  250. incrclmark:     equ            -126
  251. peekclmark:     equ            -132
  252. splitclist:     equ            -138
  253. copyclist:      equ            -144
  254. subclist:       equ            -150
  255. concatclist:    equ            -156
  256.  
  257.  
  258. ************************************************************
  259. *
  260. *              console.lib.offsets
  261. *
  262. ************************************************************
  263.  
  264.  
  265. cdinputhandler: equ            -42
  266. rawkeyconvert:  equ            -48
  267.  
  268.  
  269. ************************************************************
  270. *
  271. *              diskfont.lib.offsets
  272. *
  273. ************************************************************
  274.  
  275.  
  276. opendiskfont:   equ            -30
  277. availfonts:     equ            -36
  278.  
  279.  
  280. ************************************************************
  281. *
  282. *              dos.lib/offsets
  283. *
  284. ***********************************************************
  285.  
  286.  
  287. open:           equ            -30
  288. close:          equ            -36
  289. read:           equ            -42
  290. write:          equ            -48
  291. input:          equ            -54
  292. output:         equ            -60
  293.  
  294.  
  295. ************************************************************
  296. *
  297. *              exec.lib.offsets
  298. *
  299. ************************************************************
  300.  
  301.  
  302. absexecbase:    equ            4
  303. allocmem:       equ            -198
  304. freemem:        equ            -210
  305. getmsg:         equ            -372
  306. replymsg:       equ            -378
  307. waitport:       equ            -384
  308. closelibrary:   equ            -414
  309. opendevice:     equ            -444
  310. closedevice:    equ            -450
  311. doio:           equ            -456
  312. openlibrary:    equ            -552
  313.  
  314.  
  315. ************************************************************
  316. *
  317. *              intuition.lib.offsets
  318. *
  319. ************************************************************
  320.  
  321.  
  322. clearmenustrip: equ            -54
  323. closescreen:    equ            -66
  324. closewindow:    equ            -72
  325. openscreen:     equ            -198
  326. openwindow:     equ            -204
  327. printitext:     equ            -216
  328. setmenustrip:   equ            -264
  329. showtitle:      equ            -282
  330. viewportaddress: equ           -300
  331. windowtoback:   equ            -306
  332. windowtofront:  equ            -312
  333.  
  334.  
  335. ************************************************************
  336. *
  337. *              graphics.lib.offsets
  338. *
  339. ************************************************************
  340.  
  341.  
  342. loadrgb4:       equ            -192
  343. setrgb4:        equ            -288
  344. aa    bsr    go
  345. bb    rts
  346.     
  347. go:    move.l    4.w,a6
  348.     jsr    -132(a6)
  349.  
  350.     move.l    #frimem,d0
  351.     move.l    d0,bobmem1
  352.     add.l    #16000,d0
  353.     move.l    d0,bobmem2    ;bob bpl mem
  354.     add.l    #16000,d0
  355.     move.l    d0,megaspr    ;memory for sprite data
  356.     add.l    #2000,d0    
  357.     move.l    d0,scrmem1
  358.     add.l    #4224,d0
  359.     move.l    d0,scrmem2
  360.     add.l    #4224,d0
  361.     move.l    d0,scrmem3
  362.     add.l    #4224+8000,d0
  363.     move.l    d0,copmem
  364.  
  365.     bsr    flipp
  366.  
  367.     lea    $dff000,a0
  368.     move.w    #$4000,intena(a0)
  369.     move.w    dmaconr(a0),d0
  370.     or.w    #$8000,d0
  371.     move.w    d0,dmasaf
  372.  
  373.     move.w    #$7fff,dmacon(a0)
  374.     move.w    #%1000011111101111,dmacon(a0)
  375.  
  376.     bsr    makecop
  377.  
  378.     move.l    copmem,a1
  379.     move.l    a1,cop1lch(a0)
  380.     clr.w    copjmp1(a0)
  381.  
  382.     bsr    makespr
  383.  
  384.     move.l    #scrtext,scrpoint
  385.     bsr    fixbobsin
  386.  
  387.     bsr    calcbob
  388.  
  389.  
  390. ********* Main Program **********
  391.  
  392. main:    lea    $dff000,a0
  393.     and.w    #$20,intreqr(a0)
  394.     beq.s    main
  395.     move.w    #$20,intreq(a0)    
  396.  
  397.     bsr    stars
  398.  
  399.     bsr    calclogo
  400.  
  401.     bsr    clrbobs            ;clear bobs
  402.     bsr    putbobs            ;blit bobs
  403.     bsr    flipp            ;change bob pictures
  404.  
  405. crick:    cmp.b    #180,$dff000+vhposr    ;timing
  406.     blt.s    crick
  407.  
  408.     bsr    scroll        ;move scroll and put new chr
  409.     bsr    setlogo        ;and scroll copper pointers
  410.     bsr    calcbob        ;calc new bob pos
  411.  
  412.     btst    #6,$bfe001
  413.     bne.s    main
  414.  
  415. *********** Exit *************
  416.  
  417.     move.w    #$7fff,dmacon+$dff000
  418.     move.l    4.w,a6
  419.     jsr    -138(a6)
  420.     lea    grlib(pc),a1
  421.     jsr    -408(a6)
  422.     move.l    d0,a0
  423.     move.l    38(a0),$dff080
  424.     move.w    #0,copjmp1+$dff000
  425.     move.w    dmasaf,d0
  426.     move.w    d0,dmacon+$dff000
  427.  
  428.  
  429.     move.w    #$c000,$df000+intena
  430.     moveq    #0,d0
  431. error:    rts
  432.  
  433. ********** Sub Routines ************
  434. ;  This routine sets the grade value for the bobs
  435. ;
  436. fixbobsin:
  437.     move.w    #bobs,d0
  438.     lea    bobsin,a1
  439.     lea    bobcos,a2
  440.     clr.w    d1
  441.     clr.w    d2
  442. bobsin1:move.w    d1,(a1)+
  443.     move.w    d2,(a2)+
  444.     add.w    #8,d1        ;add value to next grade (try to chg)
  445.     add.w    #12,d2
  446.     dbf    d0,bobsin1
  447.     rts
  448.  
  449. ***********************************
  450. ;  This routine calls the sine and cosine routines
  451. ;  to calculate new positions for the bobs, normally
  452. ;  when you run the same track again and again you
  453. ;  make the sin/cos calcs before and puts them in
  454. ;  memory so you just have to fetch them.
  455.  
  456. calcbob:move.w    #bobs,d7
  457.     lea    bobsin,a1    ;pointers to grade
  458.     lea    bobcos,a2
  459.     lea    boby,a3        ;pointers to positions
  460.     lea    bobx,a4
  461.     clr.l    d0
  462. cbob1:    move.w    (a1),d0        ;get y grade
  463.     addq.w    #4,d0        ;add a value (try to change it!)
  464.     cmp.w    #360,d0        ;check not exciding 360
  465.     blt.s    cbob2
  466.     sub.w    #360,d0
  467. cbob2:    move.w    d0,(a1)+    ;grade y
  468.     move.l    #100,d2        ;origo y
  469.     move.w    #80,d1        ;radius y
  470.     bsr    getsin
  471.     move.w    d3,(a3)+    ;set y pos
  472.     
  473.     move.w    (a2),d0        ;this is the same as the sin
  474.     addq.w    #2,d0        ;just handling cos instead.
  475.     cmp.w    #360,d0
  476.     blt.s    cbob3
  477.     sub.w    #360,d0
  478. cbob3:    move.w    d0,(a2)+    ;grade x
  479.     move.w    #160-8,d2    ;origo x
  480.     move.w    #120,d1        ;radius x
  481.     bsr    getcos
  482.     move.w    d3,(a4)+    ;set x pos
  483.     dbf    d7,cbob1
  484.     rts
  485.  
  486. ************************************
  487. ;This flipps the screen so the pict just finished is
  488. ;shown and the other one will be worked with.
  489.  
  490. ;
  491. flipp:    move.l    bobmem1,d0
  492.     cmp.l    bobshow,d0
  493.     beq.s    flipp2
  494.     move.l    bobmem1,bobshow
  495.     move.l    bobmem2,bobwork
  496.     move.l    #clear2,clearp
  497.     rts
  498.  
  499. flipp2:    move.l    bobmem2,bobshow
  500.     move.l    bobmem1,bobwork
  501.     move.l    #clear1,clearp
  502.     rts
  503.  
  504.  
  505.  
  506. ************************************
  507. ; This is the bob routine, with buffering,
  508. ; that is that every frame you work with
  509. ; the bobsmem not shown and you show the other
  510.  
  511. ; Buffering is used so that you can blit the bobs
  512. ; during the whole frame without flickering. 
  513.  
  514. ; This is used in every serious game. But it takes
  515. ; the double amount of memory....
  516.  
  517. ; The new way to blit multiple bitplanes is NOT
  518. ; used, that might would have been too hard to
  519. ; understand....
  520.  
  521. clrbobs:move.l    clearp,a4
  522.     move.l    bobwork,d1
  523.     lea    $dff000,a0
  524.     move.w    #36,bltdmod(a0)
  525.     move.w    #$100,bltcon0(a0); use only destination
  526. clr1:    move.l    (a4)+,d0    ;fetch clr add
  527.     tst.l    d0
  528.     beq    error
  529.     add.l    d1,d0
  530. clr2:    btst    #6,dmaconr(a0)    ;blt nasty doesn't work with only
  531.     bne.s    clr2        ;destination.....
  532.     move.l    d0,bltdpth(a0)
  533.     move.w    #$3c2,bltsize(a0)
  534.     add.l    #8000,d0    ;clear next bitpl
  535. clr3:    btst    #6,dmaconr(a0)
  536.     bne.s    clr3
  537.     move.l    d0,bltdpth(a0)
  538.     move.w    #$3c2,bltsize(a0)
  539. clr4:    btst    #6,dmaconr(a0)
  540.     bne.s    clr4
  541.     bra.s    clr1
  542.  
  543.  
  544. putbobs:
  545.     move.w    #bobs,d0
  546.     lea    boby,a1        ;ypos in a1
  547.     lea    bobx,a2        ;xpos in a2
  548.     lea    $dff000,a0
  549.     move.l    #$ffff0000,bltafwm(a0)    ;mask off the 16 last bits
  550.     move.w    #36,bltdmod(a0)        ;40-4=36
  551.     move.w    #-2,bltamod(a0)        ;This is done becourse you have to
  552.     move.w    #-2,bltbmod(a0)        ;blit one word more to rotate bob.
  553.     move.w    #36,bltcmod(a0)
  554.  
  555. ;A is mask
  556. ;B is gfx data
  557. ;C is screen
  558. ;D is screen
  559.  
  560. putbob1:
  561.     move.l    bobwork,a3    ;destination in a3
  562.     move.w    (a1)+,d1    ;ypos in d1
  563.     move.w    (a2)+,d2    ;xpos in d2
  564.     mulu    #40,d1        ;mulu with screen width
  565.     move.w    d2,d3
  566.     and.w    #15,d3        ;get scroll value in d3
  567.     lsr.w    #3,d2        ;divide with 8 to get byte
  568.     add.w    d2,d1
  569.     move.l    clearp,a4    ;save the addr for clearing of bob
  570.     move.l    d1,(a4)+
  571.     move.l    a4,clearp
  572.     add.l    d1,a3        ;a3 now points to right dest.
  573.     ror.w    #4,d3        ;get scr val in high bits
  574.     move.w    d3,bltcon1(a0)    ;scr value for grfx
  575.     or.w    #$fca,d3    ;use ABCD
  576.  
  577. ; C and A, C or B -> D
  578. ;
  579. ;
  580.     move.w    d3,bltcon0(a0)    ;scr value for mask
  581.  
  582.     move.l    #bobraw,bltbpth(a0)
  583.     move.l    #bobmaskraw,bltapth(a0)
  584.     move.l    a3,bltdpth(a0)
  585.     move.l    a3,bltcpth(a0)
  586.  
  587.     move.w    #$3c2,bltsize(a0)
  588. waitb1:    btst    #6,dmaconr(a0)
  589.     bne.s    waitb1
  590.  
  591.     add.l    #8000,a3    ;next bpl
  592.     move.l    #bobraw+30,bltbpth(a0)
  593.     move.l    #bobmaskraw,bltapth(a0)
  594.     move.l    a3,bltdpth(a0)
  595.     move.l    a3,bltcpth(a0)
  596.     move.w    #$3c2,bltsize(a0)
  597.  
  598. waitb2:    btst    #6,dmaconr(a0)
  599.     bne.s    waitb2
  600.  
  601.     dbf    d0,putbob1
  602.     move.l    clearp,a4    ;make a zero last in the list
  603.     clr.l    (a4)
  604.     rts
  605.  
  606. ************************************
  607. ;This calcs the bumping logo
  608. ;
  609. ;
  610. ;
  611.  
  612. calclogo:
  613.     tst.w    wait1    ;check if wait
  614.     beq.s    ok1
  615.     subq.w    #1,wait1
  616.     rts
  617. ok1:    addq.w    #2,logograd
  618.     cmp.w    #180,logograd
  619.     blt.s    slipp1
  620.     clr.w    logograd
  621. slipp1:    cmp.w    #90,logograd    ;make a pause when 90 reached
  622.     bne.s    ok2
  623.     move.w    #200,wait1    ;wait 200 frames
  624. ok2:    clr.l    d0
  625.     move.w    logograd,d0    ;grade
  626.     add.w    #180,d0
  627.     move.l    #100,d1        ;radius
  628.     move.l    #104,d2        ;origo
  629.     bsr    getsin
  630.     move.w    d3,logoy    ;put new y pos
  631.     rts    
  632.  
  633. ************************************
  634. ;The actual scroll routine
  635. ;
  636. ;
  637. scroll:    tst.w    pause        ;pause ?
  638.     beq    scroll99
  639.     subq.w    #1,pause
  640.     rts
  641. scroll99:move.w    speed,d0
  642.     add.w    d0,scrcount    ;add speed (pixels)
  643.     move.w    scrcount,d0
  644.     lsr.w    #3,d0        ;pix/8
  645.     move.w    d0,scradd
  646.     move.w    scrcount,d0
  647.     and.w    #31,d0
  648.     bne    error        ;new char to put out ?
  649. scroll1:move.l    scrpoint,a1    ;Yep !
  650.     clr.l    d0
  651. scroll6:move.b    (a1)+,d0    ;get ascII in d0
  652.     cmp.w    #'^',d0        ;end of scroll ?
  653.     bne.s    scroll2
  654.     move.l    #scrtext,scrpoint
  655.     bra.s    scroll1
  656. scroll2:cmp.w    #31,d0
  657.     bgt.s    scroll5
  658.     move.w    d0,speed
  659.     bra.s    scroll6
  660. scroll5:cmp.w    #'#',d0        ;check if pause
  661.     bne.s    scroll7
  662.     move.w    #50,pause
  663.     bra.s    scroll6
  664. scroll7:move.l    a1,scrpoint
  665.     lea    fontraw,a5    ;Some math to calc char pos in bitmap
  666.     sub.w    #32,d0        ;space=0
  667.     move.w    d0,d1
  668.     divu    #10,d0        ;divide by number of chars per row
  669.     move.w    d0,d2
  670.     mulu    #1280,d0    ;multiply with one row 32*40=1280
  671.     add.l    d0,a5        ;now we point to the right row
  672.     mulu    #10,d2
  673.     sub.w    d2,d1
  674.     lsl.w    #2,d1        ;multiply with one char width 4bytes
  675.     add.w    d1,a5        ;a5 points to char in bitmap. GREAT !!
  676.  
  677.     move.l    scrmem1,a4    ;pointer to start of screen
  678.     add.l    #40,a4        ;put char on right side of screen
  679.     clr.l    d7
  680.     move.w    scradd,d7
  681.     add.l    d7,a4        ;add the scradd.
  682.  
  683.     lea    $dff000,a0    ;lets BLITT !!
  684.     move.l    #$ffffffff,bltafwm(a0)    ;no mask
  685.     move.w    #40,bltdmod(a0)    ;44-4=40
  686.     move.w    #36,bltamod(a0)    ;40-4=36
  687.     move.w    #$9f0,bltcon0(a0); D=A minterm
  688.     clr.w    bltcon1(a0)
  689.  
  690.     move.l    a4,bltdpth(a0)
  691.     move.l    a5,bltapth(a0)    ;bpl 1
  692.     move.w    #$802,bltsize(a0)
  693. waitb4:    btst    #6,dmaconr(a0)
  694.     bne.s    waitb4
  695.  
  696.     add.l    #4224,a4
  697.     add.l    #7680,a5    ;bpl 2
  698.     move.l    a4,bltdpth(a0)
  699.     move.l    a5,bltapth(a0)
  700.     move.w    #$802,bltsize(a0)
  701. waitb5:    btst    #6,dmaconr(a0)
  702.     bne.s    waitb5
  703.  
  704.     add.l    #4224,a4
  705.     add.l    #7680,a5    ;bpl 3
  706.     move.l    a4,bltdpth(a0)
  707.     move.l    a5,bltapth(a0)
  708.     move.w    #$802,bltsize(a0)
  709. waitb6:    btst    #6,dmaconr(a0)
  710.     bne.s    waitb6
  711.     rts
  712.     
  713.     
  714.  
  715. ***********************************
  716.  
  717.  
  718. ** this moves the stars to the right **
  719. ; you can speed this routine up to half
  720. ; the raster time if you change the cmp.l 
  721. ; to cmp.w , but then you have to change
  722. ; data struct in makespr aswell.
  723. ; (You have to do something yourself!!)
  724. stars:    move.l    megaspr,a1    
  725.     bsr    plupp
  726.     move.l    megaspr,a1
  727.     add.l    #1000,a1    
  728. plupp:    cmp.w    #0,(a1)
  729.     beq    error
  730.     move.w    (a1),d0
  731.     cmp.l    #$00010001,4(a1)    ;dark color ? ($555)
  732.     beq.s    slow
  733.     cmp.l    #$00000001,4(a1)    ;normal grey ?($aaa)
  734.     beq.s    medel
  735.     addi.b    #1,d0            ;bright stars ? move 3 steps
  736. medel:    addi.b    #1,d0    ;change these to sub to move left.
  737. slow:    addi.b    #1,d0
  738.     move.b    d0,1(a1)
  739.     add.l    #8,a1
  740.     bra    plupp
  741. blill:    clr.w    (a2)+
  742.     rts
  743.  
  744. ;This routine doesn't work on sprites below 255.
  745. ;But it's not hard to change it or re-write it 
  746. ;these stars routines was written a year ago....
  747.  
  748. makespr:lea    $fc0000,a3    ;creates a long random x sprite
  749.     move.l    megaspr,a2    ;at address a2
  750.     bsr    espr        ;starty in d5
  751.     move.l    megaspr,a2
  752.     add.l    #1000,a2
  753. espr:    move.l    #44,d5
  754.     move.w    #1,d4
  755. klick:    move.w    d5,d1
  756.     add.w    #2,d5
  757.     rol.w    #8,d1
  758.     move.w    d1,d3
  759.     move.w    (a3)+,d2
  760.     move.w    50(a3),d4
  761.     eor.w    d4,d2
  762.     and.l    #$ff,d2
  763.     or.w    d2,d1
  764.     move.w    d1,(a2)+
  765.     and.l    #$ff00,d3
  766.     add.w    #$100,d3
  767.     move.w    d3,(a2)+
  768.     move.w    (a3)+,d1
  769.     eor.w    d4,d1
  770.     and.w    #3,d1
  771.     cmp.w    #1,d1
  772.     bne.s    bop1
  773.     move.w    #1,d6
  774.     move.w    #0,d7
  775. bop1:    cmp.w    #2,d1
  776.     bne.s    bop2
  777.     move.w    #0,d6
  778.     move.w    #1,d7
  779. bop2:    cmp.w    #3,d1
  780.     bne.s    bop3
  781.     move.w    #1,d6
  782.     move.w    #1,d7
  783. bop3:    move.w    d6,(a2)+
  784.     move.w    d7,(a2)+
  785.     cmp.w    #244,d5        ;200 lines done ?
  786.     beq    blill        ;exit ?
  787.     bra    klick
  788.  
  789.  
  790.  
  791.  
  792. ***********************************
  793. ;This is the routine wich creates the whole
  794. ;copper list, most programmes write there copper list
  795. ;in a table.. But I find this way easier when you create
  796. ;complex copper lists with lot of colors and changeses.
  797. ;
  798.  
  799. makecop:move.l    copmem,a2        ;get copper addr in a2
  800.     move.w    #bpl2mod,(a2)+
  801.     clr.w    (a2)+
  802.     move.w    #bplcon0,(a2)+
  803.     move.w    #$5400,(a2)+        ;3 bitpl logo & 2 bitpl bobs
  804.     move.w    #color00,(a2)+
  805.     clr.w    (a2)+
  806.  
  807.     move.w    #$106,(a2)+        ;bplcon4
  808.     move.w    #0,(a2)+        ;clear it
  809.  
  810.     move.w    #$1fc,(a2)+        ;fetch mode
  811.     move.w    #0,(a2)+        ;clear it
  812.  
  813.     move.w    #bplcon2,(a2)+        ;plf 1 first, plf 2 after
  814.     move.w    #0,(a2)+        ;spr last
  815.     move.w    #bplcon1,(a2)+        ;correct scr value
  816.     move.w    #0,(a2)+
  817.     move.w    #ddfstrt,(a2)+        ;setup screen
  818.     move.w    #$0038,(a2)+        ;200*40
  819.     move.w    #ddfstop,(a2)+
  820.     move.w    #$00d0,(a2)+
  821.     move.w    #diwstrt,(a2)+
  822.     move.w    #$2c81,(a2)+
  823.     move.w    #diwstop,(a2)+
  824.     move.w    #$f4c1,(a2)+
  825.     move.l    #nslogoraw,d1        ;set bitplane pointers
  826.     move.w    #bpl1pth,d0
  827.     bsr    setbpl
  828.     add.l    #2480,d1    ;logo y*40
  829.     move.w    #bpl3pth,d0
  830.     bsr    setbpl
  831.     add.l    #2480,d1    ;logo y*40
  832.     move.w    #bpl5pth,d0
  833.     bsr    setbpl
  834.     move.w    #spr0pth,d0        ;set sprite pointers
  835.     move.l    megaspr,d1
  836.     bsr    setbpl
  837.     move.w    #spr1pth,d0
  838.     add.l    #1000,d1
  839.     bsr    setbpl
  840.     move.w    #spr2pth,d0        ;rest of the spr to dummy
  841.     move.l    #tom,d1            ;address.
  842.     bsr    setbpl
  843.     move.w    #spr3pth,d0
  844.     move.l    #tom,d1
  845.     bsr    setbpl
  846.     move.w    #spr4pth,d0
  847.     move.l    #tom,d1
  848.     bsr    setbpl
  849.     move.w    #spr5pth,d0
  850.     move.l    #tom,d1
  851.     bsr    setbpl
  852.     move.w    #spr6pth,d0
  853.     move.l    #tom,d1
  854.     bsr    setbpl
  855.     move.w    #spr7pth,d0
  856.     move.l    #tom,d1
  857.     bsr    setbpl
  858.                     ;Set colors
  859.     lea    nslogoraw+7440,a1    ;point to colors
  860.     move.w    #7,d1            ;set 8 colors
  861.     move.w    #color00,d0
  862.     bsr    setcol
  863.     lea    sprcol,a1
  864.     move.w    #3,d1
  865.     move.w    #color16,d0
  866.     bsr    setcol
  867.  
  868.     lea    bobraw+60,a1
  869.     move.w    #3,d1
  870.     move.w    #color08,d0
  871.     bsr    setcol
  872.  
  873.     move.w    #bpl1mod,(a2)+    ;logo off
  874.     move.w    #-40,(a2)+
  875.     pea    next1
  876.     move.l    a2,agg1
  877.  
  878. ** jump to this every vb to move logo to logoy **
  879. ;  Make sure that the logo doesn't reach the scroll !!!
  880. ;  This also shifts the bob screens
  881.  
  882. setlogo:move.l    agg1,a2
  883.     move.l    bobshow,d1    ;show picture not working with
  884.     move.w    #bpl2pth,d0
  885.     bsr    setbpl
  886.     add.l    #8000,d1
  887.     move.w    #bpl4pth,d0
  888.     bsr    setbpl
  889.  
  890.     move.w    logoy,d0
  891.     add.w    #44,d0        ;add vb length
  892.     lsl.w    #8,d0        ;ypos in highbyte
  893.     or.w    #1,d0        ;set bit 0
  894.     move.w    d0,(a2)+    ;wait logoy
  895.     move.w    #$ff00,(a2)+
  896.     move.w    #bpl1mod,(a2)+
  897.     clr.w    (a2)+        ;clr bplmod1, show logo
  898.  
  899.     move.w    d0,d2        ;set the colbar in the logo
  900.     move.w    logoby,d1    ;at poss logoby
  901.     lsl.w    #8,d1
  902.     add.w    d1,d2
  903.     lea    colbar3,a1
  904.     move.w    #31,d3
  905. intact:    move.w    d2,(a2)+
  906.     move.w    #$ff00,(a2)+
  907.     move.w    #color07,(a2)+
  908.     move.w    (a1)+,(a2)+
  909.     add.w    #$0100,d2
  910.     dbf    d3,intact
  911.  
  912.  
  913.     add.w    #$3d00,d0    ;show 61 lines of logo
  914.     move.w    d0,(a2)+    ;wait untill last line
  915.     move.w    #$ff00,(a2)+
  916.     move.w    #bpl1mod,(a2)+
  917.     move.w    #-40,(a2)+    ;turn logo off again.
  918.     move.w    #bpl1pth,d0
  919.     move.l    #tom,d1
  920.     bsr    setbpl    
  921.     move.w    #bpl3pth,d0
  922.     move.l    #tom,d1
  923.     bsr    setbpl    
  924.     move.w    #bpl5pth,d0
  925.     move.l    #tom,d1
  926.     bsr    setbpl    
  927.  
  928.     lea    fontraw+23040,a1    ;set scroll color
  929.     move.w    #color00,d0
  930.     move.w    #7,d1
  931.     bsr    setcol
  932.  
  933. ** this will set the bplpth's and bplcon1 for the scroll **
  934.  
  935.     move.w    #$d401,(a2)+    ;put scr at line 212
  936.     move.w    #$ff00,(a2)+
  937.     move.w    #ddfstrt,(a2)+    ;new screen width 42
  938.     move.w    #$0032,(a2)+
  939.     move.w    #bpl2mod,(a2)+    ;correct for plf 2
  940.     move.w    #-2,(a2)+
  941.     move.w    #bpl1mod,(a2)+
  942.     move.w    #2,(a2)+    ;module 2, sceen 44 bytes
  943.     move.w    scrcount,d0
  944.     and.w    #15,d0
  945.     not.w    d0
  946.     move.w    #bplcon1,(a2)+    ;plf 2=$f
  947.     move.w    d0,(a2)+
  948.     clr.l    d7
  949.     move.w    scrcount,d7
  950.     lsr.w    #3,d7
  951.     move.w    #bpl1pth,d0
  952.     move.l    scrmem1,d1
  953.     add.l    d7,d1
  954.     bsr    setbpl
  955.     move.w    #bpl3pth,d0
  956.     move.l    scrmem2,d1
  957.     add.l    d7,d1
  958.     bsr    setbpl
  959.     move.w    #bpl5pth,d0
  960.     move.l    scrmem3,d1
  961.     add.l    d7,d1
  962.     bsr    setbpl
  963.     rts
  964.  
  965. next1:    move.w    #$d40b,d0    ;legendary Ns Red Bars (C) NS
  966.     move.w    #31,d1
  967.     lea    colbar1,a1
  968. next2:    move.w    d0,(a2)+
  969.     move.w    #$fffe,(a2)+
  970.     add.w    #$0100,d0
  971.     move.w    #color00,(a2)+
  972.     move.w    (a1)+,(a2)+
  973.     lea    colbar2,a3    ;Lets make some horizontal bars !!
  974.     move.w    #42,d2
  975. next3:    move.w    #color01,(a2)+
  976.     move.w    (a3)+,(a2)+
  977.     dbf    d2,next3
  978.  
  979.     dbf    d1,next2
  980.  
  981. leave:    move.l    #$fffffffe,(a2)    ;end of copper list !!!!
  982.     rts
  983.  
  984. *** color poiner in a1..coloraddr in d0..howmany in d1
  985.  
  986. setcol:    move.w    d0,(a2)+
  987.     move.w    (a1)+,(a2)+
  988.     addq.w    #2,d0
  989.     dbf    d1,setcol
  990.     rts
  991.  
  992. *** mem in d1....bpl in d0****
  993.  
  994. setbpl:    move.w    d0,(a2)+
  995.     swap    d1
  996.     move.w    d1,(a2)+
  997.     swap    d1
  998.     addq.w    #2,d0
  999.     move.w    d0,(a2)+
  1000.     move.w    d1,(a2)+
  1001.     rts
  1002.  
  1003. *****************************************
  1004. ;
  1005. ;    d0-grad    d1-rad   d2-origo
  1006. ;=>    d3-pos
  1007.  
  1008. getsin:    cmp.w    #360,d0        ;test if spinn.
  1009.     ble.s    getsin2
  1010.     sub.w    #360,d0
  1011.     bra.s    getsin
  1012. getsin2:lea    sine,a0
  1013.     lsl.w    #1,d0
  1014.     move.w    (a0,d0),d3
  1015.     muls    d1,d3
  1016.     lsr.l    #7,d3
  1017.     add.l    d2,d3
  1018.     and.l    #$fff,d3
  1019.     rts
  1020.  
  1021. getcos:    cmp.w    #360,d0        ;test if spinn.
  1022.     ble.s    getcos2
  1023.     sub.w    #360,d0
  1024.     bra.s    getcos
  1025. getcos2:lea    sine+180,a0
  1026.     lsl.w    #1,d0
  1027.     move.w    (a0,d0),d3
  1028.     muls    d1,d3
  1029.     lsr.l    #7,d3
  1030.     add.l    d2,d3
  1031.     and.l    #$fff,d3
  1032.     rts
  1033.  
  1034.  
  1035.  
  1036. ********* Variables *************
  1037. ; Data addresses
  1038. ;
  1039. copmem:        dc.l    0
  1040. dmasaf:        dc.w    0
  1041. grlib:        dc.b    'graphics.library',0
  1042.         even
  1043. bobmem1:    dc.l    0
  1044. bobmem2:    dc.l    0    ;memory for bobs
  1045.         dc.l    0
  1046. logoy:        dc.w    0    ;logo y poss
  1047.         dc.l    0
  1048. agg1:        dc.l    0     ;memory pointer for copper
  1049. megaspr:    dc.l    0
  1050. sprcol:        dc.w    0,$fff,$aaa,$555    ;color for stars
  1051. tom:        ds.w    40        ;empty trash memory
  1052.  
  1053. ** This is the scroll text, only use capital letters **
  1054. ; use a "^" to start the scroll from the beginning.
  1055. ; use one bit numbers below 31 to change speed ex 2,4,8,16 etc
  1056. ; use "#" to make a pause.
  1057.  
  1058. scrtext:    dc.b    8,'NORTH STAR#'
  1059.         dc.b    16,'    AND   #'
  1060.         dc.b    8,'  SILENTS! #'
  1061.         dc.b    4,' PRESENTS A NEW '
  1062.         dc.b    'DEMO MADE FOR THE READERS OF EXCELLER 8'
  1063.         dc.b    ' HOW TO MAKE AN AVERAGE DEMO.. FOR SOURCE '
  1064.         dc.b    'WITH COMMENTS PLUS ALL TOOLS USED SEND 10 MAXELL '
  1065.         dc.b    'MF2 DD DISKS IN AN UNOPENED PACKAGE TO'
  1066.         dc.b    ' EXCELLER 8 '
  1067.         dc.b    'PROGRAMMING, '
  1068.         dc.b    2,'JULIG.7, 252 52 HELSINGBORG, SWEDEN... '
  1069.         dc.b    4,'THEN WE WILL SEND BACK ONE OF THE DISKS WITH '
  1070.         dc.b    'THE SOURCE !!!!        '
  1071.         dc.b    8,' H U R R Y   U P !!!!!!!    '
  1072.         dc.b    4,'IMPORTANT MESSAGE: MAHONEY,KAKTUS AND LORD VEGA IS '
  1073.         dc.b    'STILL NORTH STAR MEMBERS IN FACT MAHONEY AND KAKTUS '
  1074.         dc.b    'ARE THE NEW PROGRAMMING LEADERS SO IF YOU WANT TO '
  1075.         dc.b    'JOIN CONTACT THEM INSTEAD OF ATOM !!!        CALL OUR '
  1076.         dc.b    'BBS IN THE USA: '
  1077.         dc.b    2,'214 422 7378                   ^'
  1078.         even
  1079.  
  1080. scrmem1:    dc.l    0    ;scroll memories
  1081. scrmem2:    dc.l    0
  1082. scrmem3:    dc.l    0
  1083. scradd:        dc.w    0
  1084. scrcount:    dc.w    0
  1085. scrpoint:    dc.l    scrtext
  1086. speed:        dc.w    1    ;current scr speed
  1087. pause:        dc.w    0    ;scr pause if not zero
  1088.  
  1089. colbar1:    dcb.w    4,0        ; 3 red color bars
  1090.         dc.w    $555,$aaa,$fff,$aaa,$555
  1091.         dcb.w    5,0    
  1092.         dc.w    $555,$aaa,$fff,$aaa,$555
  1093.         dcb.w    5,0    
  1094.         dc.w    $555,$aaa,$fff,$aaa,$555,0,0,0,0,0
  1095.  
  1096. colbar2:    ;horizontal grey scale
  1097.         dc.w    $000,$111,$222,$333
  1098.         dc.w    $444,$555,$666,$777
  1099.         dc.w    $888,$999,$aaa,$bbb
  1100.         dc.w    $ccc,$ddd,$eee,$fff
  1101.         dc.w    $eee,$ddd,$ccc,$bbb
  1102.         dc.w    $aaa,$999,$888,$777
  1103.         dc.w    $666,$555,$444,$333
  1104.         dc.w    $222,$111,$000,0,0
  1105.  
  1106. logograd:    dc.w    90    ;grade for logo sin
  1107. wait1:        dc.w    300    ;wait untill logo bumb
  1108. logoby:        dc.w    0    ;ypos for colbar in logo
  1109.  
  1110. colbar3:    dc.w    $eee,$ddd,$ccc,$bbb    ;colbar in logo
  1111.         dc.w    $aaa,$999,$888,$777
  1112.         dc.w    $666,$555,$444,$333
  1113.         dc.w    $222,$111,$000,0,0
  1114.         dc.w    $000,$111,$222,$333
  1115.         dc.w    $444,$555,$666,$777
  1116.         dc.w    $888,$999,$aaa,$bbb
  1117.         dc.w    $ccc,$ddd,$eee,$fff
  1118.  
  1119. bobshow:    ds.l    1        ;pointer to bobmem to show in screen
  1120. bobwork:    ds.l    1        ;work memory
  1121. clear1:        ds.l    50        ;max bobs
  1122. clear2:        ds.l    50
  1123. clearp:        ds.l    1
  1124. boby:        ds.w    50        ;vertical poss for bobs
  1125. bobx:        ds.w    50        ;horizontal poss for bobs
  1126. bobsin:        ds.w    50
  1127. bobcos:        ds.w    50
  1128. frimem:        ds.b    60000*2
  1129.  
  1130. sat:        incbin    'coding:projects/source/oldnorthstardemo/sat'
  1131. nslogoraw:    equ    sat        ;7456
  1132. bobraw:        equ    sat+7456    ;68
  1133. bobmaskraw:    equ    sat+7524    ;34
  1134. fontraw:    equ    sat+7558    ;23056
  1135. sine:        equ    sat+30614    ;900
  1136. slut:        equ    sat+31514
  1137.  
  1138.